﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="InsertionPoint.cs" company="Luis de la Torre">
//   Copyright Luis de la Torre, unless otherwise indicated
// </copyright>
// <summary>
//   Defines the InsertionPoint type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace PVRP_SR
{
    using System.Diagnostics;

    /// <summary>
    /// The insertion point.
    /// </summary>
    public class InsertionPoint
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="InsertionPoint"/> class.
        /// </summary>
        /// <param name="insertionNode">
        /// The insertion node.
        /// </param>
        /// <param name="insertionVehicle">
        /// The insertion vehicle.
        /// </param>
        /// <param name="insertionPredecessor">
        /// The insertion predecessor.
        /// </param>
        /// <param name="insertionCost">
        /// The insertion cost.
        /// </param>
        /// <param name="insertionDistance">
        /// The insertion distance.
        /// </param>
        public InsertionPoint(
            int insertionNode, 
            int insertionVehicle, 
            int insertionPredecessor, 
            double insertionCost, 
            double insertionDistance)
        {
            Debug.Assert(insertionNode >= 0, "invalid insertion node index");
            Debug.Assert(insertionVehicle >= 0, "invalid insertion vehicle index");
            Debug.Assert(insertionPredecessor >= 0, " invalid insertion predecessor index");
            Debug.Assert(this.InsertionCost >= 0, "invalid insertion cost");
            Debug.Assert(
                this.InsertionDistance >= 0 && this.InsertionDistance <= this.InsertionCost, 
                "insertion distance must be less than insertion cost");
            this.InsertionNode = insertionNode;
            this.InsertionVehicle = insertionVehicle;
            this.InsertionPredecessor = insertionPredecessor;
            this.InsertionCost = insertionCost;
            this.InsertionDistance = insertionDistance;
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets the insertion cost.
        /// </summary>
        public double InsertionCost { get; private set; }

        /// <summary>
        /// Gets the insertion distance.
        /// </summary>
        public double InsertionDistance { get; private set; }

        /// <summary>
        /// Gets the insertion node.
        /// </summary>
        public int InsertionNode { get; private set; }

        /// <summary>
        /// Gets the insertion predecessor.
        /// </summary>
        public int InsertionPredecessor { get; private set; }

        /// <summary>
        /// Gets the insertion vehicle.
        /// </summary>
        public int InsertionVehicle { get; private set; }

        #endregion
    }
}